

import lombok.EqualsAndHashCode;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;

/**
*
* ${classComment}实体类
* @author ${authorName}
* @date ${.now?string('yyyy-MM-dd')}
*
**/
@Entity
@Table(name = "${tableName}")
@org.hibernate.annotations.Table(appliesTo = "${tableName}", comment = "${classComment}")
@Data
@EqualsAndHashCode(callSuper = true)
@DynamicUpdate
@DynamicInsert
public class ${className}Entity extends JpaAuditFields< ${className}Entity > {

<#if fieldList?? && fieldList?size gt 0>
    <#list fieldList as fieldItem >
        <#if fieldItem.fieldName!="createTime" &&
        fieldItem.fieldName!="createUserName" &&
        fieldItem.fieldName!="updateTime" &&
        fieldItem.fieldName!="updateUserName">

            /**
            * ${fieldItem.fieldComment}
            **/
        <#if primaryKey.pk==fieldItem.fieldName>
            <#if primaryKey.pk??>@Id</#if>
            <#if primaryKey.pkType=="auto_increment">@GeneratedValue(strategy = GenerationType.IDENTITY)</#if>
        </#if>
            @Column(columnDefinition = "${fieldItem.columnClass}<#if fieldItem.blank =="true"> not null</#if><#if fieldItem.defaultStr??&&fieldItem.defaultStr!=""> default ${fieldItem.defaultStr}</#if> <#if fieldItem.fieldComment??&&fieldItem.fieldComment!="">comment '${fieldItem.fieldComment}'</#if>")
            private ${fieldItem.fieldClass} ${fieldItem.fieldName};
        </#if>
    </#list>
</#if>

}